import Vue from 'vue'
import Router from 'vue-router'
import administer from '@/components/administer'
import login from '@/components/login'
import user from '@/components/user'
import administrator from '@/components/administrator'
import Musicmanagement from '@/components/Musicmanagement'
import singerList from '@/components/singerList'
import addForm from '@/components/addForm'
import examine from '@/components/examine'
import albumList from '@/components/albumList'
import addAlbum from '@/components/addAlbum'
import musicList from '@/components/musicList'
import addMusic from '@/components/addMusic'


Vue.use(Router)

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    routes: [{
            path: '/',
            name: 'administer',
            component: administer,
            children: [{
                    path: '/user',
                    name: 'user',
                    component: user,
                },
                {
                    path: '/administrator',
                    name: 'administrator',
                    component: administrator,
                },
                {
                    path: '/Musicmanagement',
                    name: 'Musicmanagement',
                    component: Musicmanagement,
                },
                {
                    path: '/singerList',
                    name: 'singerList',
                    component: singerList,
                },
                {
                    path: '/addForm',
                    name: 'addForm',
                    component: addForm,
                },
                {
                    path: '/examine',
                    name: 'examine',
                    component: examine,
                },
                {
                    path: '/albumList',
                    name: 'albumList',
                    component: albumList,
                },
                {
                    path: '/addAlbum',
                    name: 'addAlbum',
                    component: addAlbum,
                },
                {
                    path: '/musicList',
                    name: 'musicList',
                    component: musicList,
                },
                {
                    path: '/songtable',
                    name: 'songtable',
                    component: songtable,
                },
                {
                    path: '/songtablelist',
                    name: 'songtablelist',
                    component: songtablelist,
                },
                {
                    path: '/addMusic',
                    name: 'addMusic',
                    component: addMusic,
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: login,
        },
    ]
})